<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>A页面</title>
</head>

<body>
  用来接受访问相关其他内容
  <div id="message"></div>
  <script>
    window.addEventListener('message', function (event) {
      console.log(event);
      document.getElementById('message').innerHTML = "收到" +
        event.origin + "消息：" + event.data;
    }, false);
  </script>
</body>

</html>